﻿using System.Diagnostics.Contracts;
using System.IO;

namespace OpenWaves.ImageTransformations.Web
{
    [ContractClass(typeof(VirtualFileContract))]
    public interface IVirtualFile
    {
        Url Url { get; }
        string Hash { get; }
        Stream Open();
    }

    [ContractClassFor(typeof(IVirtualFile))]
    abstract class VirtualFileContract : IVirtualFile
    {
        public Url Url
        {
            get
            {
                Contract.Ensures(Contract.Result<Url>() != null);
                throw new System.NotImplementedException();
            }
        }

        public string Hash
        {
            get
            {
                // Can be null if the path provider is not able to provide one
                throw new System.NotImplementedException();
            }
        }

        public Stream Open()
        {
            Contract.Ensures(Contract.Result<Stream>() != null);
            throw new System.NotImplementedException();
        }
    }
}